package ar.com.fiuba.ElectronicCircuitAnalyst.domain.api;

import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.InvalidCircuitElementException;

/**
 * A component with inputs and outputs.
 * 
 * For every output there is a logical function (based on the inputs).
 */
public interface Component extends CircuitElement {

	/**
	 * Adds an input lead to the component.
	 * 
	 * @param input
	 *            the lead to add
	 * @throw InvalidCircuitElementException if component ends up with an
	 *        invalid state.
	 */
	public void addInputLead(Lead input) throws InvalidCircuitElementException;

	/**
	 * Adds an output lead and its corresponding function to the component.
	 * 
	 * @param output
	 *            the lead to add
	 * @param function
	 *            the function of the lead to add
	 * @throw InvalidCircuitElementException if component ends up with an
	 *        invalid state.
	 */
	public void addOutputLead(Lead output, LogicalFunction function) throws InvalidCircuitElementException;

	/**
	 * @return the name of this component
	 */
	public String getName();

	/**
	 * @return the type of this component
	 */
	public String getType();

}
